package com.hui.demo.consumer;

import com.hui.demo.model.Mood;
import com.hui.demo.service.MoodService;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 消费者
 * @author ziv
 * @date 218-12-24
 */
@Component
public class MoodConsumer {

    @Resource
    private MoodService moodService;

    @JmsListener(destination = "ziv.queue")
    public void receiveQueue(String text) {
        System.out.println("用户发表说说：" + text + "成功");
    }

    @JmsListener(destination = "ziv.queue.asyn.save")
    public void receiveQueue(Mood mood) {
        moodService.save(mood);
    }

}
